// TypeScript file
module Fighter {

    /**
     * 准备完成UI——郭启航
     */
    export class ReadyUI extends eui.Component {

        constructor() {
            super();
            this.skinName = "resource/assets/PlaneE/ReadyUI.exml";
            this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
        }
        /**返回按钮*/
        public Reday_back: eui.Image;
        /**开始游戏*/
        public Reday_startgame: eui.Image;
        /**金币提示*/
        public Reday_MoneyShow: eui.BitmapLabel;
        /**僚机数*/
        public Reday_BuyWingman: eui.BitmapLabel;
        /**敌机数*/
        public Reday_BuyEnemy: eui.BitmapLabel;
        /**投资金币*/
        public Reday_Invest: eui.BitmapLabel;
        // /**血量*/
        // public Reday_Hp:eui.Label;
        // /**攻击*/
        // public Reday_AKT:eui.Label;
        // /**护甲*/
        // public Reday_ARM:eui.Label;
        // /**攻速*/
        // public Reday_ATT:eui.Label;
        // /**子弹排数*/
        // public Reday_double:eui.Label;
        /**返回按钮Bool*/
        public Is_back: boolean;
        /**开始游戏Bool*/
        public Is_startgame: boolean;
        public onAddToStage() {
            this.Reday_back.addEventListener(egret.TouchEvent.TOUCH_TAP, this.Close, this)
            this.Reday_startgame.addEventListener(egret.TouchEvent.TOUCH_TAP, this.Startgame, this)
            this.addEventListener(egret.Event.ENTER_FRAME, this.show, this)


        }
       /**跳转场景——关闭准备界面*/
        public Close() {
            this.Is_back = true;
        }
        public Startgame() {
            this.Is_startgame = true;
            GameUtil.PlayerMessage.instance.isReady = true;
        }
        /**每帧更新提示信息*/
        public show() {
            this.Reday_Invest.text = GameUtil.PlayerMessage.instance.investment.toString();
            this.Reday_MoneyShow.text =  GameUtil.PlayerMessage.instance.money.toString();
            this.Reday_BuyEnemy.text = (GameUtil.PlayerMessage.instance.sendEnemy.length - GameUtil.PlayerMessage.instance.PlaneNum).toString();
            if(GameUtil.PlayerMessage.instance.isBuyFollowPlane && GameUtil.PlayerMessage.instance.isBuyAroundPlane)
            {
                this.Reday_BuyWingman.text = "2";
            }else if(GameUtil.PlayerMessage.instance.isBuyFollowPlane || GameUtil.PlayerMessage.instance.isBuyAroundPlane)
            {
                this.Reday_BuyWingman.text = "1";
            }else{
                this.Reday_BuyWingman.text = "0";
            }
            
        }
    }
}